const { dialog } = require('electron');
const os = require('os');
const version = require('../package.json').version;

function info() {
  dialog.showMessageBox({
    title: '关于',
    type: 'info',
    message: '关于',
    detail: `版本信息：${version}\n引擎版本：${
      process.versions.v8
    }\n当前系统：${os.type()} ${os.arch()} ${os.release()}`,
    noLink: true,
    buttons: ['确定'],
  });
}

const menu = [
  {
    label: '设置',
    submenu: [
      {
        label: '快速重启',
        accelerator: 'F5',
        role: 'reload',
      },
      {
        label: '退出',
        accelerator: 'CmdOrCtrl+F4',
        role: 'close',
      },
    ],
  },
  {
    label: '关于',
    submenu: [
      {
        label: '关于',
        click: function () {
          info();
        },
      },
    ],
  },
];

module.exports = menu;
